Skip to content

perf: default stmt to func#827

Merged
anthony-swirldslabs merged 4 commits into
mainfrom
defaultStmtToFunc
May 15, 2026
Merged

perf: default stmt to func#827
anthony-swirldslabs merged 4 commits into
mainfrom
defaultStmtToFunc

Conversation

@ldintr
Copy link
Copy Markdown
Contributor

@ldintr ldintr commented May 14, 2026

Description:

Moves default case into its own function so optimizer can choose what to inline

Prev bench numbers

Benchmark (type) Mode Cnt Score Error Units
GenericParserQuickBench.bench NotCacheableAccountIDType thrpt 15 292.432 ± 14.627 ops/us
https://github.com/hashgraph/pbj/actions/runs/25826669514/job/75881464290

New

Default Case Commit

Benchmark (type) Mode Cnt Score Error Units
GenericParserQuickBench.bench NotCacheableAccountIDType thrpt 15 446.331 ± 7.801 ops/us
https://github.com/hashgraph/pbj/actions/runs/25863069512/job/75997769734

Some additional cases as func from generateFieldCaseStatementPacked

Benchmark (type) Mode Cnt Score Error Units
GenericParserQuickBench.bench NotCacheableAccountIDType thrpt 15 450.417 ± 2.910 ops/us
https://github.com/hashgraph/pbj/actions/runs/25867304244/job/76012761470

NOTE: Hash is different because I ran this before applying spotlight

Benchmark (type) Mode Cnt Score Error Units
GenericParserQuickBench.bench NotCacheableAccountIDType thrpt 15 451.509 ± 5.192 ops/us
https://github.com/hashgraph/pbj/actions/runs/25921616637/job/76191842411

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@ldintr ldintr requested review from a team as code owners May 14, 2026 13:43
@ldintr ldintr self-assigned this May 14, 2026
@ldintr ldintr changed the title Default stmt to func perf: default stmt to func May 14, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

JUnit Test Report

   521 files  ±0     521 suites  ±0   25s ⏱️ -1s
 1 519 tests ±0   1 515 ✅ ±0   4 💤 ±0  0 ❌ ±0 
10 407 runs  ±0  10 379 ✅ ±0  28 💤 ±0  0 ❌ ±0 

Results for commit 96800f7. ± Comparison against base commit 5158f98.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

Integration Test Report

    426 files  ±0      426 suites  ±0   16m 34s ⏱️ - 6m 42s
115 028 tests ±0  115 028 ✅ ±0  0 💤 ±0  0 ❌ ±0 
115 270 runs  ±0  115 270 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 96800f7. ± Comparison against base commit 5158f98.

♻️ This comment has been updated with latest results.

@ldintr ldintr force-pushed the defaultStmtToFunc branch from 946785d to da893c1 Compare May 14, 2026 13:50
ldintr added 2 commits May 14, 2026 09:54
Signed-off-by: ldintr <levo.d@swirldslabs.com>
Signed-off-by: ldintr <levo.d@swirldslabs.com>
@ldintr ldintr force-pushed the defaultStmtToFunc branch from da893c1 to 95af07d Compare May 14, 2026 13:54
…unction

Signed-off-by: ldintr <levo.d@swirldslabs.com>
Copy link
Copy Markdown
Contributor

@anthony-swirldslabs anthony-swirldslabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance numbers look great.

The code looks good overall, too. I added a few comments, mostly of stylistic nature about both the generator and the generated code.

Also, it'd be useful to attach a copy of a generated codec for reviewers to examine the changes (you can attach it to a GitHub comment in this PR.) A good candidate would be the EverythingProtoCodec.java file as it would show almost everything there's in PBJ.

@ldintr ldintr force-pushed the defaultStmtToFunc branch from 927b5cb to 6d34699 Compare May 15, 2026 14:04
Signed-off-by: ldintr <levo.d@swirldslabs.com>
@ldintr ldintr force-pushed the defaultStmtToFunc branch from 6d34699 to 96800f7 Compare May 15, 2026 18:32
@ldintr
Copy link
Copy Markdown
Contributor Author

ldintr commented May 15, 2026

Fixed. Here's the before and after of EverythingProtoCodec.java
after.java
before.java
diff.patch

@anthony-swirldslabs anthony-swirldslabs merged commit 48926c8 into main May 15, 2026
18 checks passed
@anthony-swirldslabs anthony-swirldslabs deleted the defaultStmtToFunc branch May 15, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants